package com.tongzhan.config;

import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.support.MongoRepositoryFactoryBean;
import org.springframework.data.repository.core.support.RepositoryFactorySupport;

import java.io.Serializable;

public class CustomMongoRepositoryFactoryBean<T extends MongoRepository<S, ID>, S, ID extends Serializable>
		extends MongoRepositoryFactoryBean<T, S, ID> {

	public CustomMongoRepositoryFactoryBean(Class<? extends T> repositoryInterface) {
		super(repositoryInterface);
	}

	@Override
	protected RepositoryFactorySupport getFactoryInstance(MongoOperations operations) {
		return new MRepositoryFactory<>(operations);
	}
}